<template>
    <div class="stock-account">
        <TopTitleExit title="Stock Account" :exit="routerExit"></TopTitleExit>
        <div class="main">
            <div class="top-grid">
                <div class="item">
                    <div class="k">Available</div>
                    <div class="v">${{ userInfo.balance }}</div>
                </div>
                <div class="item">
                    <div class="k">Frozon</div>
                    <div class="v">${{ userInfo.freeze }}</div>
                </div>
                <div class="item">
                    <div class="k">Total</div>
                    <div class="v">${{ (parseFloat(userInfo.balance) + parseFloat(userInfo.freeze)).toFixed(2) }}</div>
                </div>
            </div>
            <div class="list">
                <div class="item">
                    <div class="top">
                        <div class="date">11/25/2025 12:13:34</div>
                        <div class="status">Outcome</div>
                    </div>
                    <div class="center">
                        <div class="grid">
                            <div class="val">
                                <div class="k">Amt.</div>
                                <div class="v">100.00</div>
                            </div>
                            <div class="val">
                                <div class="k">Frozon</div>
                                <div class="v">100.00</div>
                            </div>
                            <div class="val">
                                <div class="k">Available</div>
                                <div class="v">11223.12</div>
                            </div>
                        </div>
                    </div>
                    <div class="bottom">
                        <div class="val">
                            <div class="k">Type</div>
                            <div class="v">Buy Stocks</div>
                        </div>
                        <div class="val">
                            <div class="k">Remark</div>
                            <div class="v">AMZN.US</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import TopTitleExit from '@/components/common/TopTitleExit.vue';
import { routerExit } from '@/utils/jump';
import { userInfo } from '@/service/user';
</script>

<style scoped lang="less">
.stock-account {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;

    .main {
        box-sizing: border-box;
        width: 100%;
        flex: 1;
        overflow-y: auto;
        padding: 3vw;

        .top-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            grid-gap: 2vw;

            .item {
                padding: 1vw 0 5vw;
                text-align: center;

                .k {
                    font-size: 4vw;
                    font-weight: 500;
                    color: var(--active-color);
                }

                .v {
                    font-size: 3.5vw;
                }
            }
        }

        .list {
            display: flex;
            flex-direction: column;
            gap: 3vw;

            .item {
                box-sizing: border-box;
                width: 100%;
                padding: 3vw;
                border-radius: 2vw;
                box-shadow: 0 0 3vw rgba(0, 0, 0, 0.1);
                display: flex;
                flex-direction: column;
                gap: 3vw;

                .top {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;

                    .date {
                        font-size: 3.3vw;
                        color: var(--text-color);
                    }

                    .status {
                        font-size: 3.5vw;
                        font-weight: 500;
                        color: var(--positive-number-color);
                    }
                }

                .center {
                    .grid {
                        display: grid;
                        grid-template-columns: repeat(3, 1fr);
                        grid-gap: 2vw;

                        .val {
                            text-align: center;

                            &:first-child {
                                text-align: left;
                            }

                            &:last-child {
                                text-align: right;
                            }

                            .k {
                                font-size: 3.5vw;
                                font-weight: 500;
                            }

                            .v {
                                font-size: 3vw;
                            }
                        }
                    }
                }

                .bottom {
                    display: flex;
                    justify-content: space-between;

                    .val {
                        &:first-child {
                            text-align: left;
                        }

                        &:last-child {
                            text-align: right;
                        }

                        .k {
                            font-size: 3.5vw;
                            font-weight: 500;
                        }

                        .v {
                            font-size: 3vw;
                        }
                    }
                }
            }
        }
    }
}
</style>